//
//  IntroduceCtrl.m
//  LvXingPai
//
//  Created by _Junxee on 16/8/12.
//  Copyright © 2016年 _Junxee. All rights reserved.
//

#import "IntroduceCtrl.h"
@interface IntroduceCtrl ()
@property (weak, nonatomic) IBOutlet UITextView *MainTextView;


@end

@implementation IntroduceCtrl

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setBarButStyle];
    [self loadData];
    self.title = @"城市简介";
    self.tabBarController.tabBar.hidden = YES;
}

-(void)setBmodel:(DestinModel *)Bmodel{
    _Bmodel = Bmodel;
}

#pragma mark -- 设置导航栏样式和按钮
-(void)setBarButStyle{
    UIBarButtonItem *leftBtn = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"common_icon_navigation_back_normal"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction:)];
    self.navigationItem.leftBarButtonItem = leftBtn;
}

-(void)backAction:(UIBarButtonItem *)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark -- 请求简介数据

-(void)loadData{
    
    AFHTTPRequestOperationManager * Manger = [AFHTTPRequestOperationManager manager];
    Manger.responseSerializer = [AFHTTPResponseSerializer serializer];
    [Manger GET:[NSString stringWithFormat:@"http://api.lvxingpai.com/app/geo/localities/%@?imgWidth=750",_Bmodel.pushId] parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSDictionary *dict1 = dict[@"result"];
        NSString * desc = dict1[@"desc"];
        self.MainTextView.text = desc;
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"f");
    }];
}


@end
